<%-- 
    Document   : calculator
    Created on : 23.10.2012, 3:04:08
    Author     : eleven
--%>

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@page import="calculator.TypeCalculator"%>
<%@page import="java.util.*" %>
<%@page import="hibernate.entityes.City" %>
<%@page import="calculator.TypeCalculator" %>
<!DOCTYPE html>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Distance Calculator</title>
    </head>    
    <body>
        <h1>Distance Calculator</h1>     
        <jsp:useBean id="cities" scope="session" class="java.util.ArrayList"/>
        <jsp:useBean id="typescalc" scope="session" class="java.util.LinkedList"/>        
        <form method="post" name="calculationform" accept-charset="utf-8" action="Action/calculate/perform">
            Type    
            <select  size="1" name="typecalculation">
                <%
                    for (Iterator i = typescalc.iterator(); i.hasNext();) {
                        TypeCalculator typecalc = (TypeCalculator) i.next();
                %>
                <option value = "<%=typecalc.getId()%>">
                    <%=typecalc.getId()%>
                </option>   
                <%}%>       
            </select></br></br>
            From 
            <select size="1" name="fromcity">
                <%
                    for (Iterator i = cities.iterator(); i.hasNext();) {
                        City city = (City) i.next();
                %>
                <option value ="<%= city.getName()%>">
                    <%=city.getName()%>
                </option>   
                <%}%>

            </select></br>  
            To 
            <select size="1" name="tocity">
                <%
                    for (Iterator i = cities.iterator(); i.hasNext();) {
                        City city = (City) i.next();
                %>
                <option value="<%= city.getName()%>">
                    <%=city.getName()%>
                </option>   
                <%}%>       
            </select> </br></br>
            <input type="submit"  value="Calculate"/>
        </form>
        </br>
        <a href="administration.jsp">Administration Page</a>
    </body>
</html>